﻿@model MeetingFormModel
@{
	ViewBag.Title = Resources.MeetingContribute + ConstValues.strDash + ViewBag.ConferenceName;
}
<div class="rbox fl" style="width:1200px">
	<div id="right">
		<div class="con">
			<div class="formDiv">
				<form id="frmForm" method="post" enctype="multipart/form-data">
					@Html.AntiForgeryToken()
					<span id="ctnForm"></span>
					<input type="hidden" id="hidCurrentPage" name="currentPage" />
					<input type="hidden" id="hidConferenceId" name="ConferenceId" />
					<input type="hidden" id="hidAwardsList" name="AwardsList" />
					<input type="hidden" id="hidAwardsName"  />
					<input type="hidden" id="hidIsNormal" />
					<input type="hidden" id="hidProgramAbstract" />
					<input type="hidden" id="hidAbstract" />
					<input type="hidden" id="chkPrivacy" />
					<input type="hidden" id="hidAuthor" />
				</form>
			</div>
		</div>
	</div>
</div>
@section bodyParts {
<div id="authorWindow" class="easyui-window"
	title="@Resources.Author" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; max-height:800px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="authorWindowTitle" class="tit01">@Resources.Create</h3>
			<form id="frmAuthor" method="post">
				@Html.AntiForgeryToken()
				<table width="100%" height="100%" id="tblAuthor" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.FamilyName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="hidAuthorId" name="Id" type="hidden" />
							<input id="hidAuthorConferenceId" name="ConferenceId" type="hidden" />
							<input id="hidContributeId" name="ContributeId" type="hidden" />
							<input id="txtFamilyName" name="FamilyName" class="easyui-textbox" style="height:27px; width:300px;" data-options="prompt:'@Resources.FamilyNamePrompt',required:true, validType:['length[1,100]']">
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.FirstName：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtFirstName" name="FirstName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true, validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.FullName：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtFullName" name="FullName" class="easyui-textbox"  style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.Sort：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtSort" name="Sort" class="easyui-numberbox" style="height:27px; width:300px;" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.ContactAddress：</td>
						<td style="text-align: left;" class="w2 c2" colspan="3">
							<input id="txtAddress" name="Address" class="easyui-textbox" style="height:27px; width:892px;" data-options="validType:['length[1,200]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3">@Resources.ZipCode：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtZipCode" name="ZipCode" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c3">@Resources.Email：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtMail" name="Mail" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['email','length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Mobile：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtMobile" name="Mobile" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true, validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c1">@Resources.CcMail：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtCcMail" name="CcMail" class="easyui-textbox" style="height:27px; width:300px;"  />
						</td>
					</tr>
					<tr>
						<td style="text-align: right; " class="w1 c3">@Resources.PersonalIntroduction：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="txtSelfIntroduction" name="SelfIntroduction" class="easyui-textbox" style="height:100px; width:892px" data-options="multiline:true" />										
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1">@Resources.Status：</td>
						<td style="text-align: left;" class="w2 c2">
							<select id="ddlStatus" name="Status" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,required:true,panelHeight:'auto'">
								<option value="@ConstValues.Status.正常">@Resources.Normal</option>
								<option value="@ConstValues.Status.暂停">@Resources.Pause</option>
							</select>
						</td>
						<td style="text-align: right;" class="w1 c1"></td>
						<td style="text-align: left;" class="w2 c2"></td>
					</tr>
					<tr>
						<td style="text-align: right; " class="w1 c3">@Resources.Remark：</td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="txtRemark" name="Remark" class="easyui-textbox" style="height:50px; width:892px;" data-options="multiline:true, validType:['length[1,1000]']" />
						</td>
					</tr>
				</table>
				<h3 class="tit01"><a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-add" style="background:#919295;color:#000;border:none;margin-left:5px;" onclick="common.addAffliation();">@Resources.Create@Resources.Affiliation</a></h3>
				<table width="100%" height="100%" id="tblAuthor" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
					<tr id="trAffiliation0">
						<td style="text-align: right;" class="w1 c1">@Resources.Affiliation 1：</td>
						<td style="text-align: left;" class="w12 c2">
							<input id="txtAffiliation0" name="Affiliation0" class="easyui-textbox" style="height:27px; width:380px;" data-options="required:true,validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c1">@Resources.Country 1：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="ddlCountry0" name="Country0" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation1" style="display:none">
						<td style="text-align: right;" class="w1 c3">@Resources.Affiliation 2：</td>
						<td style="text-align: left;" class="w12 c4">
							<input id="txtAffiliation1" name="Affiliation1" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c3">@Resources.Country 2：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlCountry1" name="Country1" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation2" style="display:none">
						<td style="text-align: right;" class="w1 c1">@Resources.Affiliation 3：</td>
						<td style="text-align: left;" class="w12 c2">
							<input id="txtAffiliation2" name="Affiliation2" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c1">@Resources.Country 3：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="ddlCountry2" name="Country2" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation3" style="display:none">
						<td style="text-align: right;" class="w1 c3">@Resources.Affiliation 4：</td>
						<td style="text-align: left;" class="w12 c4">
							<input id="txtAffiliation3" name="Affiliation3" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c3">@Resources.Country 4：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlCountry3" name="Country3" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation4" style="display:none">
						<td style="text-align: right;" class="w1 c1">@Resources.Affiliation 5：</td>
						<td style="text-align: left;" class="w12 c2">
							<input id="txtAffiliation4" name="Affiliation4" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c1">@Resources.Country 5：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="ddlCountry4" name="Country4" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation5" style="display:none">
						<td style="text-align: right;" class="w1 c3">@Resources.Affiliation 6：</td>
						<td style="text-align: left;" class="w12 c4">
							<input id="txtAffiliation5" name="Affiliation5" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c3">@Resources.Country 6：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlCountry5" name="Country5" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation6" style="display:none">
						<td style="text-align: right;" class="w1 c1">@Resources.Affiliation 7：</td>
						<td style="text-align: left;" class="w12 c2">
							<input id="txtAffiliation6" name="Affiliation6" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c1">@Resources.Country 7：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="ddlCountry6" name="Country6" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation7" style="display:none">
						<td style="text-align: right;" class="w1 c3">@Resources.Affiliation 8：</td>
						<td style="text-align: left;" class="w12 c4">
							<input id="txtAffiliation7" name="Affiliation7" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c3">@Resources.Country 8：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlCountry7" name="Country7" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation8" style="display:none">
						<td style="text-align: right;" class="w1 c1">@Resources.Affiliation 9：</td>
						<td style="text-align: left;" class="w12 c2">
							<input id="txtAffiliation8" name="Affiliation8" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c1">@Resources.Country 9：</td>
						<td style="text-align: left;" class="w2 c2">
							<input id="ddlCountry8" name="Country8" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
					<tr id="trAffiliation9" style="display:none">
						<td style="text-align: right;" class="w1 c3">@Resources.Affiliation 10：</td>
						<td style="text-align: left;" class="w12 c4">
							<input id="txtAffiliation9" name="Affiliation9" class="easyui-textbox" style="height:27px; width:380px;" data-options="validType:['length[1,4000]']" />
						</td>
						<td style="text-align: right;" class="w8 c3">@Resources.Country 10：</td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlCountry9" name="Country9" class="easyui-combobox" style="height:27px; width:300px;">
						</td>
					</tr>
				</table>
			</form>
			<div class="btnDiv">
				<input type="hidden" id="hdnAuthorWindowType" />
				<input type="hidden" id="hdnAuthorGridIndex" />
				<input type="button" class="gbtn" onclick="addAuthor();" value="@Resources.Submit" />&nbsp;&nbsp;
				<input type="button" class="rbtn" onclick="$('#authorWindow').window('close');" value="@Resources.Cancel" />
			</div>
		</div>
	</div>
</div>
<div id="previewWindow" class="easyui-window"
	title="@Resources.Preview" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="previewWindow" class="tit01">@Resources.Preview</h3>
			<div class="formDiv">
				<form id="previewForm" name="previewForm" method="post" enctype="multipart/form-data">
					@Html.AntiForgeryToken()
					<span id="ptnForm"></span>
					<table width="100%" height="100%" id="tblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">								
						<tr id="titleTr">
							<td style="text-align: right;" class="w1 c1">@Resources.EssayTitle：</td>
							<td style="text-align: left;" class="w10 c2">
								<span id="l-title"></span>
							</td>
						</tr>
						<tr id="authorTr" >
							<td style="text-align: right;" class="w1 c3">@Resources.Author：</td>
							<td style="text-align: left;" class="w10 c4">
								<span id="l-author"></span>
							</td>
						</tr>
						<tr id="affiliationTr" >
							<td style="text-align: right;" class="w1 c1">@Resources.Affiliation：</td>
							<td style="text-align: left;" class="w10 c2">
								<span id="l-affiliation"></span>
							</td>
						</tr>
						<tr id="abstractTr" style="display:none">
							<td style="text-align: right;" class="w1 c3">@Resources.OnlyAbstract：</td>
							<td style="text-align: left;" class="w10 c4">
								<span id="l-abstract"></span>
							</td>
						</tr>
						<tr id="keywordTr">
							<td style="text-align: right;" class="w1 c1">@Resources.Keyword：</td>
							<td style="text-align: left;" class="w10 c2">
								<span id="l-keyword"></span>
							</td>
						</tr>
						<tr id="topicNameTr">
							<td style="text-align: right;" class="w1 c3">@Resources.TopicName：</td>
							<td style="text-align: left;" class="w10 c4">
								<span id="l-topicName"></span>
							</td>
						</tr>
						<tr id="essayTypeNameTr">
							<td style="text-align: right;" class="w1 c1">@Resources.EssayType：</td>
							<td style="text-align: left;" class="w10 c2">
								<span id="l-essayTypeName"></span>
							</td>
						</tr>
						<tr id="reportTypeTr">
							<td style="text-align: right;" class="w1 c3">@Resources.ReportType：</td>
							<td style="text-align: left;" class="w10 c4">
								<span id="l-reportType"></span>
							</td>
						</tr>
						<tr id="programAbstractTr">
							<td style="text-align: right;" class="w1 c1">@Resources.ProgramAbstract：</td>
							<td style="text-align: left;" class="w10 c2">
								<span id="l-programAbstract"></span>
							</td>
						</tr>
						<tr id="abstractFileTr">
							<td style="text-align: right;" class="w1 c3">@Resources.AbstractFile：</td>
							<td style="text-align: left;" class="w10 c4">
								<span id="l-abstractFile"></span>
							</td>
						</tr>
						<tr id="supplementaryFileTr">
							<td style="text-align: right;" class="w1 c1">@Resources.SupplementaryFile：</td>
							<td style="text-align: left;" class="w10 c2">
								<span id="l-supplementaryFile"></span>
							</td>
						</tr>
						<tr id="journalTr">
							<td style="text-align: right;" class="w1 c3">@Resources.TargetJournal：</td>
							<td style="text-align: left;" class="w10 c4">
								<span id="l-journal"></span>
							</td>
						</tr>
						<tr id="awardsTr">
							<td style="text-align: right;" class="w1 c1">@Resources.Awards：</td>
							<td style="text-align: left;" class="w10 c2">
								<span id="l-awards"></span>
							</td>
						</tr>
					</table>
					<input type="hidden" id="hidIsNormalPreview" />
				</form>
			</div>
			<div class="btnDiv">
				<input type="button" class="rbtn" onclick="$('#previewWindow').window('close');" value="@Resources.Close" />
			</div>
		</div>
	</div>
</div>
}

@section Scripts {
<script>
	$(function () {
		@if (Request.Cookies["_culture"] != null) {
			<text>
			if ("@Request.Cookies["_culture"].Value" != "@Model.Language") {
				$("#hidCulture").val("@Model.Language");
				$("#frmCulture").submit();
			}
			</text>
		}

		if ("@Model.Language" == "@ConstValues.Language.Cn") {
			$("#mlogo").html("");
			$("#mlogo").append('<img id="logo" src="../Images/homeImg/logo.jpg" />')
		} else {
			$("#mlogo").html("");
			$("#mlogo").append('<img id="logo" src="../Images/homeImg/enlogo.jpg" />')
		}

		$(this).scrollTop(0);

		$("#hidCurrentPage").val(0);
		$("#hidConferenceId").val("@Model.ConferenceId");
		$("#hidIsNormal").val(0);
		$("#chkPrivacy").val(0);

		getItems(0, 2);

		$("#authorWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: 100
		});

		$("#previewWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
				$("#ptnForm").html("");
			},
			height: 800,
			top: 100
		});

		$("input",$("#txtFullName").next("span")).click(function(){
			var language = "@Model.Language";
			var tempTxt = "";
			if (language == "@ConstValues.Language.Cn") {
				//tempTxt = $("#txtFamilyName").textbox("getValue")+$("#txtFirstName").textbox("getValue");
			} else {
				tempTxt = $("#txtFirstName").textbox("getValue") +" "+$("#txtFamilyName").textbox("getValue");
			}

			$("#txtFullName").textbox("setValue",tempTxt);
		})
	});

	function getItems(page, skipType) {
		$("#hidCurrentPage").val(page);
		if ($("#authorDG").length > 0) {
			$("#hidAuthor").val(JSON.stringify($("#authorDG").datagrid("getRows")));
		}
		$("#ctnForm").html("");

		if (page == 0) {
			$("#ctnForm").append("<div id='requirement' style='max-height:calc(100vh - 240px);overflow-y: auto;'></div><br />");
			$("#requirement").append("@Html.Raw(Model.SubmitRequirement.Replace("\"", "'"))");
			$("#requirement").append("<div class='clear'></div><br />");

			setButton();
			$("#transferRight").prop("checked",$("#chkPrivacy").val() == "0" ? false : true);
			checkAgree();
		} else if (page == @Model.TotalPage + 1) {
			$("#ctnForm").append("<br /><input type='button' class='abtn' onclick='openAuthor();' value='+ @Resources.Author' /><div class='clear'></div><br />");
			$("#ctnForm").append("<div id='authorDG'></div>");

			$("#authorDG").datagrid({
				width: 1200,
				height: 600,
				nowrap: false,
				striped: true,
				singleSelect: true,
				singleCheck: true,
				remoteSort: false,
				frozenColumns: [[
					{
						field: "operate", title: "@Resources.Operate", align: "center", width: 150,
						formatter: function(value, rec, index) {
							var tmp = rec.fullName == null ? "" : rec.fullName.replace(new RegExp("'",'g'),"’").replace(new RegExp('"','g'),"“");
							var strInfo = "<a href='#' style='color:#66CDAA;font-weight:bold;text-decoration:underline;' onclick='editAuthor(\""
								+ index + "\",\"" +tmp + "\")'>@Resources.Modify</a>";
							strInfo += "&nbsp;|&nbsp;"
							strInfo += "<a href='#' style='color:#DC143C;font-weight:bold;text-decoration:underline;' onclick='deleteAuthor(\""
								+ index + "\",\"" +tmp + "\")'>@Resources.Delete</a>";
							return strInfo;
						}
					},
					{ field: "sort", title: "@Resources.Sort", align: "center", sortable: true, width: 80 },
					{ field: "fullName", title: "@Resources.FullName", align: "center", width: 200,
						formatter: function(value, rec) {
							if (null != value && "" != value) {
								return value;
							} else {
								return rec.familyName + " " + rec.firstName
							}
						}
					},
					{ field: "mail", title: "@Resources.Mail", align: "center", width: 250 },
				]],
				columns: [[
					{ field: "affiliation", title: "@Resources.Affiliation", align: "center", width: 200 },
					{
						field: "status", title: "@Resources.Status", align: "center",  width: 100,
						formatter: function(value, rec) {
							if (value=="@ConstValues.Status.正常") {
								return "@Resources.Normal"
							} else {
								return "@Resources.Pause"
							}
						}
					},
					{
						field: "isContactAuthor", title: "@Resources.ContactAuthor", align: "center", width: 150,
						formatter: function(value, rec, index) {
							var strInfo = "";
							if (rec.isContactAuthor == true) {
								strInfo = "<input type='checkbox' style='margin-top:8px;' onchange='changeContactAuthor(" + index + ")' checked/>";
							} else {
								strInfo = "<input type='checkbox' style='margin-top:8px;' onchange='changeContactAuthor(" + index + ")' />";
							}
							return strInfo;
						}
					},
					{
						field: "isPresenter", title: "@Resources.Presenter", align: "center", width: 100,
						formatter: function(value, rec, index) {
							var strInfo = "";
							if (rec.isPresenter == true) {
								strInfo = "<input type='checkbox' style='margin-top:8px;' onchange='changePresenter(" + index + ")' checked/>";
							} else {
								strInfo = "<input type='checkbox' style='margin-top:8px;' onchange='changePresenter(" + index + ")' />";
							}
							return strInfo;
						}
					},
					{ field: "remark", title: "@Resources.Remark", align: "center",  width: 200 },
					{ field: "familyName", hidden: true },
					{ field: "firstName", hidden: true },
					{ field: "country", hidden: true },
					{ field: "state", hidden: true },
					{ field: "city", hidden: true },
					{ field: "address", hidden: true },
					{ field: "zipCode", hidden: true },
					{ field: "mobile", hidden: true },
					{ field: "ccMail", hidden: true },
					{ field: "selfIntroduction", hidden: true },
					{ field: "affiliation0", hidden: true },
					{ field: "affiliation1", hidden: true },
					{ field: "affiliation2", hidden: true },
					{ field: "affiliation3", hidden: true },
					{ field: "affiliation4", hidden: true },
					{ field: "affiliation5", hidden: true },
					{ field: "affiliation6", hidden: true },
					{ field: "affiliation7", hidden: true },
					{ field: "affiliation8", hidden: true },
					{ field: "affiliation9", hidden: true },
					{ field: "country0", hidden: true },
					{ field: "country1", hidden: true },
					{ field: "country2", hidden: true },
					{ field: "country3", hidden: true },
					{ field: "country4", hidden: true },
					{ field: "country5", hidden: true },
					{ field: "country6", hidden: true },
					{ field: "country7", hidden: true },
					{ field: "country8", hidden: true },
					{ field: "country9", hidden: true },
				]],
			});

			if ($("#hidAuthor").val() != "") {
				var authorList = JSON.parse(decodeURIComponent($("#hidAuthor").val()));
				for (var index = 0; index < authorList.length; index++) {
					$("#authorDG").datagrid("appendRow", {
						familyName: authorList[index].familyName,
						firstName: authorList[index].firstName,
						fullName: authorList[index].fullName,
						affiliation: authorList[index].affiliation,
						country: authorList[index].country,
						address: authorList[index].address,
						zipCode: authorList[index].zipCode,
						mobile: authorList[index].mobile,
						mail: authorList[index].mail,
						ccMail: authorList[index].ccMail,
						selfIntroduction: authorList[index].selfIntroduction,
						status: authorList[index].status,
						sort: authorList[index].sort,
						remark: authorList[index].remark,
						isContactAuthor: authorList[index].isContactAuthor,
						isPresenter: authorList[index].isPresenter,
						affiliation0: authorList[index].affiliation0,
						affiliation1: authorList[index].affiliation1,
						affiliation2: authorList[index].affiliation2,
						affiliation3: authorList[index].affiliation3,
						affiliation4: authorList[index].affiliation4,
						affiliation5: authorList[index].affiliation5,
						affiliation6: authorList[index].affiliation6,
						affiliation7: authorList[index].affiliation7,
						affiliation8: authorList[index].affiliation8,
						affiliation9: authorList[index].affiliation9,

						country0: authorList[index].country0,
						country1: authorList[index].country1,
						country2: authorList[index].country2,
						country3: authorList[index].country3,
						country4: authorList[index].country4,
						country5: authorList[index].country5,
						country6: authorList[index].country6,
						country7: authorList[index].country7,
						country8: authorList[index].country8,
						country9: authorList[index].country9,
					});
				}
			}

			setButton();
		} else {
			var url = "@Url.Action(nameof(MeetingContributeController.GetCurrentPageItem),
					nameof(MeetingContributeController).GetControllerName())"
					+ "/" + $("#hidConferenceId").val()
					+ "/" + $("#hidCurrentPage").val()
					+ "?random=" + Math.random();

			$.get(url, null, function (data, textStatus, jqXHR) {
				if (data.result == "@ConstValues.AjaxSuccessResult") {
					for (var index = 0; index < data.data.length; index++) {
						if (data.data[index].key == "AbstractFile" || data.data[index].key == "SupplementaryFile") {
							$("#ctnForm").append("<div class='titleDiv'>" + data.data[index].displayName + "：</div>"
								+ "<div class='contentDiv'>"
								+ "<input class='easyui-filebox' style='height:27px; width:500px' id='txt" + data.data[index].key + "' name='" + data.data[index].key + "' />"
								+ "&nbsp;&nbsp;<a href='javascript:void(0)' class='easyui-linkbutton' id='txt" + data.data[index].key + "Clear' onclick='$(\"#txt" + data.data[index].key + "\").filebox(\"clear\");'>@Resources.Clear</a>"
								+ "</div>"
								+ "<div class='clear'></div>"
							);

							$("#txt" + data.data[index].key).filebox({
								prompt: data.data[index].tip,
								required: data.data[index].isRequired,
								buttonText: "@Resources.ChooseFile"
							});
						}
						else if (data.data[index].key == "Topic") {
							$("#ctnForm").append("<div class='titleDiv'>" + data.data[index].displayName + "：</div>"
								+ "<div class='contentDiv'>"
								+ "<input class='easyui-combobox' style='height:27px; width:500px' id='txtTopic' name='Topic' />"
								+ "&nbsp;&nbsp;<a href='javascript:void(0)' class='easyui-linkbutton' id='txtTopicClear' onclick='$(\"#txtTopic\").combobox(\"clear\");'>@Resources.Clear</a>"
								+ "</div>"
								+ "<div class='clear'></div>"
							);

							var orgCount = 0;
							$("#txtTopic").combobox({
								prompt: data.data[index].tip,
								required: data.data[index].isRequired,
								editable: false,
								valueField: "id",
								textField: "name",
								url: "@Url.Action(nameof(UtilityController.GetTopic), nameof(UtilityController).GetControllerName())"
										+ "?conferenceId=" + $("#hidConferenceId").val(),
								onLoadSuccess: function(data) {
									orgCount = data.length;
								},
								onShowPanel: function () {
									if (orgCount < 10) {
										$(this).combobox("panel").height("auto");
									} else {
										$(this).combobox("panel").height(200);
									}
								}
							});
						}
						else if (data.data[index].key == "Essay")
						{
							$("#ctnForm").append("<div class='titleDiv'>" + data.data[index].displayName + "：</div>"
								+ "<div class='contentDiv'>"
								+ "<input class='easyui-combobox' style='height:27px; width:500px' id='txtEssay' name='Essay' />"
								+ "&nbsp;&nbsp;<a href='javascript:void(0)' class='easyui-linkbutton' id='txtEssayClear' onclick='$(\"#txtEssay\").combobox(\"clear\");'>@Resources.Clear</a>"
								+ "</div>"
								+ "<div class='clear'></div>"
							);

							var orgCount = 0;
							$("#txtEssay").combobox({
								prompt: data.data[index].tip,
								required: data.data[index].isRequired,
								editable: false,
								valueField: "id",
								textField: "name",
								url: "@Url.Action(nameof(UtilityController.GetEssay), nameof(UtilityController).GetControllerName())"
										+ "?conferenceId=" + $("#hidConferenceId").val(),
								onLoadSuccess: function(data) {
									orgCount = data.length;
								},
								onShowPanel: function () {
									if (orgCount < 10) {
										$(this).combobox("panel").height("auto");
									} else {
										$(this).combobox("panel").height(200);
									}
								}
							});
						}
						else if (data.data[index].key == "Report") {
							$("#ctnForm").append("<div class='titleDiv'>" + data.data[index].displayName + "：</div>"
								+ "<div class='contentDiv'>"
								+ "<input class='easyui-combobox' style='height:27px; width:500px' id='txtReport' name='Report' />"
								+ "&nbsp;&nbsp;<a href='javascript:void(0)' class='easyui-linkbutton' id='txtReportClear' onclick='$(\"#txtReport\").combobox(\"clear\");'>@Resources.Clear</a>"
								+ "</div>"
								+ "<div class='clear'></div>"
							);

							var orgCount = 0;
							$("#txtReport").combobox({
								prompt: data.data[index].tip,
								required: data.data[index].isRequired,
								editable: false,
								valueField: "id",
								textField: "name",
								url: "@Url.Action(nameof(UtilityController.GetReport), nameof(UtilityController).GetControllerName())"
										+ "?conferenceId=" + $("#hidConferenceId").val(),
								onLoadSuccess: function(data) {
									orgCount = data.length;
								},
								onShowPanel: function () {
									if (orgCount < 10) {
										$(this).combobox("panel").height("auto");
									} else {
										$(this).combobox("panel").height(200);
									}
								}
							});
						}
						else if (data.data[index].key == "Ocis") {
							$("#ctnForm").append("<div class='titleDiv'>" + data.data[index].displayName + "：</div>"
								+ "<div class='contentDiv'>"
								+ "<input class='easyui-combobox' style='height:27px; width:500px' id='txtOcis' name='Ocis' />"
								+ "&nbsp;&nbsp;<a href='javascript:void(0)' class='easyui-linkbutton' id='txtOcisClear' onclick='$(\"#txtOcis\").combobox(\"clear\");'>@Resources.Clear</a>"
								+ "</div>"
								+ "<div class='clear'></div>"
							);

							var orgCount = 0;
							$("#txtOcis").combobox({
								prompt: data.data[index].tip,
								required: data.data[index].isRequired,
								editable: false,
								valueField: "id",
								textField: "name",
								url: "@Url.Action(nameof(UtilityController.GetOCIS), nameof(UtilityController).GetControllerName())"
										+ "?conferenceId=" + $("#hidConferenceId").val(),
								onLoadSuccess: function(data) {
									orgCount = data.length;
								},
								onShowPanel: function () {
									if (orgCount < 10) {
										$(this).combobox("panel").height("auto");
									} else {
										$(this).combobox("panel").height(200);
									}
								}
							});
						}
						else if (data.data[index].key == "Journal")
						{
							$("#ctnForm").append("<div class='titleDiv'>" + data.data[index].displayName + "：</div>"
								+ "<div class='contentDiv'>"
								+ "<input class='easyui-combobox' style='height:27px; width:500px' id='txtJournal' name='Journal' />"
								+ "&nbsp;&nbsp;<a href='javascript:void(0)' class='easyui-linkbutton' id='txtJournalClear' onclick='$(\"#txtJournal\").combobox(\"clear\");'>@Resources.Clear</a>"
								+ "</div>"
								+ "<div class='clear'></div>"
							);

							var orgCount = 0;
							$("#txtJournal").combobox({
								prompt: data.data[index].tip,
								required: data.data[index].isRequired,
								editable: false,
								valueField: "id",
								textField: "name",
								url: "@Url.Action(nameof(UtilityController.GetJournal), nameof(UtilityController).GetControllerName())"
										+ "?conferenceId=" + $("#hidConferenceId").val(),
								onLoadSuccess: function(data) {
									orgCount = data.length;
								},
								onShowPanel: function () {
									if (orgCount < 10) {
										$(this).combobox("panel").height("auto");
									} else {
										$(this).combobox("panel").height(200);
									}
								}
							});
						}
						else if (data.data[index].key == "ProgramAbstract") {
							if ($("#txtAbstract").length == 0)
							{
								$("#ctnForm").append("<div class='titleDiv large'>" + data.data[index].displayName + "：</div>"
									+ "<div class='contentDiv large'>"
									+"<input type=hidden id='txtProgramAbstract' name='ProgramAbstract' />"
									+"<div class='grid-container'>"
									+"<div class='grid-width-100' style='margin-left:-30px; min-height:100px; width:560px'>"
									+"<textarea cols='90' rows='10' id='editor' name='editor'></textarea>"
									+"</div>"
									+"</div>"
									+"</div>"
									+ "<div class='clear'></div>"
								);
							} else {
								$("#ctnForm").append("<div class='titleDiv large'>" + data.data[index].displayName + "：</div>"
									+ "<div class='contentDiv large'>"
									+"<input type=hidden id='txtProgramAbstract' name='ProgramAbstract' />"
									+"<div class='grid-container'>"
									+"<div class='grid-width-100' style='margin-left:-30px; min-height:100px; width:560px'>"
									+"<textarea cols='90' rows='10' id='editorSec' name='editor'></textarea>"
									+"</div>"
									+"</div>"
									+"</div>"
									+ "<div class='clear'></div>"
								);
								$("#hidIsNormal").val(1);
							}

							if (data.data[index].isRequired == true) {
								$("#hidProgramAbstract").val(1);
							} else {
								$("#hidProgramAbstract").val(0);
							}
						}
						else if (data.data[index].key == "Abstract") {
							if ($("#txtProgramAbstract").length == 0) {
								$("#ctnForm").append("<div class='titleDiv large'>" + data.data[index].displayName + "：</div>"
									+ "<div class='contentDiv large'>"
									+"<input type=hidden id='txtAbstract' name='Abstract' />"
									+"<div class='grid-container'>"
									+"<div class='grid-width-100' style='margin-left:-30px; min-height:100px; width:560px'>"
									+"<textarea cols='90' rows='10' id='editor' name='editorSec'></textarea>"
									+"</div>"
									+"</div>"
									+"</div>"
									+ "<div class='clear'></div>"
								);
								$("#hidIsNormal").val(1);
							} else {
								$("#ctnForm").append("<div class='titleDiv large'>" + data.data[index].displayName + "：</div>"
									+ "<div class='contentDiv large'>"
									+"<input type=hidden id='txtAbstract' name='Abstract' />"
									+"<div class='grid-container'>"
									+"<div class='grid-width-100' style='margin-left:-30px; min-height:100px; width:560px'>"
									+"<textarea cols='90' rows='10' id='editorSec' name='editorSec'></textarea>"
									+"</div>"
									+"</div>"
									+"</div>"
									+ "<div class='clear'></div>"
								);
							}

							if (data.data[index].isRequired == true) {
								$("#hidAbstract").val(1);
							} else {
								$("#hidAbstract").val(0);
							}
						}
						else if (data.data[index].key == "Awards") {
							if(@Model.AwardsCount > 0){
								$("#ctnForm").append("<h3 id='authorWindowTitle' class='tit01'>@Resources.Awards</h3>"
									+ "<div id='awardsDG'></div>"
									+ "<div class='clear'></div>"
								);

								$("#awardsDG").datagrid({
									url: "@Url.Action(nameof(UtilityController.GetAwardsMasterList), nameof(UtilityController).GetControllerName())",
									method: "get",
									fitColumns: true,
									checkOnSelect: false,
									selectOnCheck: false,
									height: 500,
									nowrap: false,
									pageSize: @ConstValues.DefaultGridRows,
									striped: true,
									singleSelect: true,
									singleCheck: true,
									columns: [[
										{ field: "awardsName", title: "@Resources.AwardsName", align: "center", width: 200 },
										{ field: "awardsContent", title: "@Resources.AwardsContent", align: "center", width: 550 },
										{
											field: "link", title: "@Resources.Link", align: "center", width: 300 ,
											formatter: function(value, rec) {
												if (value == null) {
													return "@ConstValues.strHyphen@ConstValues.strHyphen";
												} else {
													return "<a href='" + value + "' style='color:#1874CD;text-decoration:underline;' target='_blank'>" + value + "</a>";
												}
											}
										},
										{
											field: "awardsId", title: "@Resources.ApplyOrDecline", align: "center", width: 150,
											formatter: function(value, rec) {
												var strInfo = "<input type='checkbox' style='margin-top:8px;' onchange='applyOrDecline(\"" + rec.id + "\",\"" + rec.awardsName + "\")' />";
												return strInfo;
											}
										},
									]],
									onBeforeLoad: function(param) {
										param.conferenceId = $("#hidConferenceId").val();
										param.random = Math.random();
									},
									onLoadSuccess: function(data) {
										var awardsList = $("#hidAwardsList").val();
										if (data.rows.length > 0) {
											var awardsListArray = awardsList.split("@ConstValues.chrSemicolon");
											for (var rowIndex = 0; rowIndex < data.rows.length; rowIndex++)
											{
												for (var index = 0; index < awardsListArray.length; index++)
												{
													if (data.rows[rowIndex].id == awardsListArray[index]) {
														$("input[type='checkbox']").eq(rowIndex).prop("checked", true);
														break;
													}
												}
											}
										}
									},
								});
							} else {
								if (skipType == 1) {
									getItems(page-1);
									return;
								} else if (skipType == 2) {
									getItems(page+1);
									return;
								}
							}
						}
						else {
							$("#ctnForm").append("<div class='titleDiv'>" + data.data[index].displayName + "：</div>"
								+ "<div class='contentDiv'>"
								+ "<input class='easyui-textbox' style='height:27px; width:500px' id='txt" + data.data[index].key + "' name='" + data.data[index].key + "' />"
								+ "</div>"
								+ "<div class='clear'></div>"
							);

							$("#txt" + data.data[index].key).textbox({
								prompt: data.data[index].tip,
								required: data.data[index].isRequired,
								validType: "length[1,500]"
							});
						}
					}

					if($("#txtProgramAbstract").length > 0 || $("#txtAbstract").length > 0){
						var language = "@Request.Cookies["_culture"].Value";
						if (language == "@ConstValues.Language.Cn") {
							CKEDITOR.config.language = "zh-cn";
						} else {
							CKEDITOR.config.language = "en";
						}

						initSample();

						if ($("#editor").length > 0) {
							if (CKEDITOR.instances["editor"]) {
								CKEDITOR.instances["editor"].destroy();
							}

							if ($("#hidIsNormal").val() == 0) {
								if (language == "@ConstValues.Language.Cn") {
									ckeditor = CKEDITOR.replace("editor", {
										wordcount: {
											extraPlugins: "wordcount",
											showWordCount: false,
											showCharCount: true,
											showParagraphs: false,
											maxCharCount: 240,
										}
									});
									CKFinder.setupCKEditor(ckeditor,"~/Scripts/ckfinder/")
								} else {
									ckeditor = CKEDITOR.replace("editor", {
										wordcount: {
											extraPlugins: "wordcount",
											showWordCount: true,
											showCharCount: false,
											showParagraphs: false,
											maxWordCount: 300,
										}
									});
									CKFinder.setupCKEditor(ckeditor,"~/Scripts/ckfinder/")
								}
							} else {
								if (language == "@ConstValues.Language.Cn") {
									ckeditor = CKEDITOR.replace("editor", {
										wordcount: {
											extraPlugins: "wordcount",
											showWordCount: false,
											showCharCount: true,
											showParagraphs: false,
											maxCharCount: 1000,
										}
									});
									CKFinder.setupCKEditor(ckeditor,"~/Scripts/ckfinder/")
								} else {
									ckeditor = CKEDITOR.replace("editor", {
										wordcount: {
											extraPlugins: "wordcount",
											showWordCount: true,
											showCharCount: false,
											showParagraphs: false,
											maxWordCount: 1500,
										}
									});
									CKFinder.setupCKEditor(ckeditor,"~/Scripts/ckfinder/")
								}
							}
							CKEDITOR.instances.editor.setData("");
						}
						if ($("#editorSec").length > 0) {
							if ($("#hidIsNormal").val() == 0) {
								if (language == "@ConstValues.Language.Cn") {
									ckeditor2 = CKEDITOR.replace("editorSec", {
										wordcount: {
											extraPlugins: "wordcount",
											showWordCount: false,
											showCharCount: true,
											showParagraphs: false,
											maxCharCount: 1000,
										}
									});
									CKFinder.setupCKEditor(ckeditor2,"~/Scripts/ckfinder/")
								} else {
									ckeditor2 = CKEDITOR.replace("editorSec", {
										wordcount: {
											extraPlugins: "wordcount",
											showWordCount: true,
											showCharCount: false,
											showParagraphs: false,
											maxWordCount: 1500,
										}
									});
									CKFinder.setupCKEditor(ckeditor2,"~/Scripts/ckfinder/")
								}
							}
							else {
								if (language == "@ConstValues.Language.Cn") {
									ckeditor2 = CKEDITOR.replace("editorSec", {
										wordcount: {
											extraPlugins: "wordcount",
											showWordCount: false,
											showCharCount: true,
											showParagraphs: false,
											maxCharCount: 240,
										}
									});
									CKFinder.setupCKEditor(ckeditor2,"~/Scripts/ckfinder/")
								} else {
									ckeditor2 = CKEDITOR.replace("editorSec", {
										wordcount: {
											extraPlugins: "wordcount",
											showWordCount: true,
											showCharCount: false,
											showParagraphs: false,
											maxWordCount: 300,
										}
									});
									CKFinder.setupCKEditor(ckeditor2,"~/Scripts/ckfinder/")
								}
							}
							CKEDITOR.instances.editorSec.setData("");
						}
					}

					url = "@Url.Action(nameof(MeetingContributeController.GetCurrentPageValue),
							nameof(MeetingContributeController).GetControllerName())"
							+ "/" + $("#hidConferenceId").val()
							+ "?random=" + Math.random();
					$.get(url, null, function (data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxSuccessResult") {
							if($("#txtProgramAbstract").length > 0){
								if ($("#hidIsNormal").val() == 0) {
									setTimeout(function () {
										CKEDITOR.instances.editor.setData(data.data.programAbstract);
									}, 500);
								} else {
									setTimeout(function () {
										CKEDITOR.instances.editorSec.setData(data.data.programAbstract);
									}, 500);
								}
							}
							if ($("#txtAbstract").length > 0) {
								if ($("#hidIsNormal").val() == 0) {
									setTimeout(function () {
										CKEDITOR.instances.editorSec.setData(data.data.abstract);
									}, 500);
								}
								else {
									setTimeout(function () {
										CKEDITOR.instances.editor.setData(data.data.abstract);
									}, 500);
								}
							}
							$("#txtEssayTitle").textbox("setValue", data.data.essayTitle);
							$("#txtKeyword").textbox("setValue", data.data.keyword);
							$("#txtAbstractFile").filebox("setText", data.data.abstractFile);
							$("#txtSupplementaryFile").filebox("setText", data.data.supplementaryFile);
							$("#txtTopic").combobox("setValue", data.data.topicId);
							$("#txtEssay").combobox("setValue", data.data.essayId);
							$("#txtReport").combobox("setValue", data.data.reportId);
							$("#txtOcis").combobox("setValue", data.data.ocisId);
							$("#txtJournal").combobox("setValue", data.data.journalId);
						}
					});

					setButton();
				} else {
					setButton();
				}
			});
		}
	}

	function setButton() {
		var temp = "";
		var page = parseInt($("#hidCurrentPage").val());
		var totalPage = @Model.TotalPage;

		if (page == 0) {
			temp +="<input type='checkbox' name='' style='height:25px; vertical-align:top;' value='0' id='transferRight' onchange='checkAgree()' /> @Resources.CopyRightComfirm"
			temp +="<a href='javascript:void(0);' onclick='showPrivacy();'><span class='xinhao' style='color:red;'>@Resources.CopyrightAgreement</span></a><br/><br/>"
		}

		if (page != 0) {
			var previous = page - 1;
			temp += "<input type='button'  class='sbtn' onclick='saveTmp(" + previous + ", true,1);' value='@Resources.Previous' />";
		}

		if (page != totalPage + 1) {
			var next = page + 1;
			if (page == 0) {
				temp += "&nbsp;&nbsp;<input type='button'  class='obtn' id='saveBtn' disabled='disabled' onclick='saveTmp(" + next + ", false,2);' value='@Resources.Next' />"
			} else {
				temp += "&nbsp;&nbsp;<input type='button'  class='lbtn' onclick='saveTmp(" + next + ", false,2);' value='@Resources.Next' />"
			}
		} else {
			temp += "&nbsp;&nbsp;<input type='button' id='previewBtn' class='lbtn' disabled:true onclick='previewData();' value='@Resources.Preview' />"
			temp += "&nbsp;&nbsp;<input type='button' class='gbtn'  onclick='submitData();' value='@Resources.Submit' />"
			temp += "&nbsp;&nbsp;<input type='button' class='rbtn' onclick='javascript: history.go(-1);' value='@Resources.Back' />"
		}
		$("#ctnForm").append("<div class='clear'></div><div style='padding: 25px 0; text-align: center;'>" + temp + "</div>");
	}

	function saveTmp(page, isLast, skipType) {
		var isValid = $("#frmForm").form("validate");

		if (isLast) {
			isValid = true;
		}

		if (isValid) {
			if ($("#hidCurrentPage").val() != 0) {
				if ($("#txtProgramAbstract").length > 0) {
					if ($("#hidIsNormal").val() == 0) {
						if ($("#hidProgramAbstract").val() == 1 && CKEDITOR.instances.editor.getData() == "") {
							var errorMessage = "@Resources.MsgIsEmpty";
							errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.ProgramAbstract");
							common.showError(errorMessage);
							CKEDITOR.instances.editor.focus();
							return;
						}
						$("#txtProgramAbstract").val(CKEDITOR.instances.editor.getData());
					}
					else {
						if ($("#hidProgramAbstract").val() == 1 && CKEDITOR.instances.editorSec.getData() == "") {
							var errorMessage = "@Resources.MsgIsEmpty";
							errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.ProgramAbstract");
							common.showError(errorMessage);
							CKEDITOR.instances.editor.focus();
							return;
						}
						$("#txtProgramAbstract").val(CKEDITOR.instances.editorSec.getData());
					}
				}

				if ($("#txtAbstract").length > 0) {
					if ($("#hidIsNormal").val() == 0) {
						if ($("#hidAbstract").val() == 1 && CKEDITOR.instances.editorSec.getData() == "") {
							var errorMessage = "@Resources.MsgIsEmpty";
							errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Abstract");
							common.showError(errorMessage);
							CKEDITOR.instances.editor.focus();
							return;
						}
						$("#txtAbstract").val(CKEDITOR.instances.editorSec.getData());
					}
					else {
						if ($("#hidAbstract").val() == 1 && CKEDITOR.instances.editor.getData() == "") {
							var errorMessage = "@Resources.MsgIsEmpty";
							errorMessage = errorMessage.replace(/\{0\}/g, "@Resources.Abstract");
							common.showError(errorMessage);
							CKEDITOR.instances.editor.focus();
							return;
						}
						$("#txtAbstract").val(CKEDITOR.instances.editor.getData());
					}
				}

				if ($("#txtAbstractFile").length >0) {
					var abstractFile = $("#txtAbstractFile").filebox("getText")
					if (null != abstractFile && "" != abstractFile) {
						if (!/\.(doc|docx|pdf|DOC|DOCX|PDF)$/.test(abstractFile)){
							common.showError("@Resources.MsgDocumentType");
							return;
						}
					}
				}

				if ($("#txtSupplementaryFile").length > 0) {
					var supplementaryFile = $("#txtSupplementaryFile").filebox("getText")
					if (null != supplementaryFile && "" != supplementaryFile) {
						if (!/\.(doc|docx|pdf|DOC|DOCX|PDF)$/.test(supplementaryFile)) {
							common.showError("@Resources.MsgDocumentType");
							return;
						}
					}
				}

				$("#frmForm").form({
					iframe: false,
					success: function (data) { }
				});

				$("#frmForm").form("submit", {
					url: "@Url.Action(nameof(MeetingContributeController.CreateTmp), nameof(MeetingContributeController).GetControllerName())",
					onSubmit: function (param) {
						param.random = Math.random();
					}
				});
			}

			$("#chkPrivacy").val(1);
			getItems(page, skipType);
		}
	}

	function openAuthor() {
		initAuthorForm();

		$("#ddlCountry0").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: true
		});
		$("#ddlCountry1").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry2").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry3").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry4").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry5").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry6").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry7").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry8").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry9").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});

		var sort = 1;
		if ($("#authorDG").datagrid("getData").rows.length > 0) {
			var sortList = $("#authorDG").datagrid("getData").rows;

			for (var index = 0; index < sortList.length; index++) {
				if (sort < parseInt(sortList[index].sort)) {
					sort = parseInt(sortList[index].sort)
				}
			}
			sort += 1;
		}
		$("#txtSort").numberbox("setValue",sort)
		$("#authorWindow").window("open");
	}

	function initAuthorForm() {
		$("#txtFamilyName").textbox("setValue", "");
		$("#txtFirstName").textbox("setValue", "");
		$("#txtFullName").textbox("setValue", "");

		$("#txtAddress").textbox("setValue", "");
		$("#txtZipCode").textbox("setValue", "");
		$("#txtMobile").textbox("setValue", "");
		$("#txtMail").textbox("setValue", "")
		$("#txtCcMail").textbox("setValue", "")
		$("#txtSelfIntroduction").textbox("setValue", "");
		$("#ddlStatus").combobox("setValue", "@ConstValues.Status.正常");
		$("#txtSort").numberbox("setValue", @ConstValues.DefaultSort);
		$("#txtRemark").textbox("setValue", "");
		$("#hdnAuthorWindowType").val("add");

		$("#txtAffiliation0").textbox("setValue", "");
		$("#txtAffiliation1").textbox("setValue", "");
		$("#txtAffiliation2").textbox("setValue", "");
		$("#txtAffiliation3").textbox("setValue", "");
		$("#txtAffiliation4").textbox("setValue", "");
		$("#txtAffiliation5").textbox("setValue", "");
		$("#txtAffiliation6").textbox("setValue", "");
		$("#txtAffiliation7").textbox("setValue", "");
		$("#txtAffiliation8").textbox("setValue", "");
		$("#txtAffiliation9").textbox("setValue", "");

		$("#ddlCountry0").textbox("setValue", "");
		$("#ddlCountry1").textbox("setValue", "");
		$("#ddlCountry2").textbox("setValue", "");
		$("#ddlCountry3").textbox("setValue", "");
		$("#ddlCountry4").textbox("setValue", "");
		$("#ddlCountry5").textbox("setValue", "");
		$("#ddlCountry6").textbox("setValue", "");
		$("#ddlCountry7").textbox("setValue", "");
		$("#ddlCountry8").textbox("setValue", "");
		$("#ddlCountry9").textbox("setValue", "");

		$("#trAffiliation0").css("display", "");
		$("#trAffiliation1").css("display", "none");
		$("#trAffiliation2").css("display", "none");
		$("#trAffiliation3").css("display", "none");
		$("#trAffiliation4").css("display", "none");
		$("#trAffiliation5").css("display", "none");
		$("#trAffiliation6").css("display", "none");
		$("#trAffiliation7").css("display", "none");
		$("#trAffiliation8").css("display", "none");
		$("#trAffiliation9").css("display", "none");
	}

	function changeContactAuthor(num) {
		var dataList = $("#authorDG").datagrid("getRows");
		if (dataList[num].isContactAuthor == true) {
			$("#authorDG").datagrid("updateRow", {
				index: num,
				row: {
					isContactAuthor: false,
				}
			});
		} else {
			$("#authorDG").datagrid("updateRow", {
				index: num,
				row: {
					isContactAuthor: true,
				}
			});
		}
	}

	function changePresenter(num) {
		var dataList = $("#authorDG").datagrid("getRows");
		if (dataList[num].isPresenter == true) {
			$("#authorDG").datagrid("updateRow", {
				index: num,
				row: {
					isPresenter: false,
				}
			});
		} else {
			$("#authorDG").datagrid("updateRow", {
				index: num,
				row: {
					isPresenter: true,
				}
			});
		}

		for (var index = 0; index < dataList.length; index++) {
			if (index != num && dataList[index].isPresenter == true)
			{
				$("#authorDG").datagrid("updateRow", {
					index: index,
					row: {
						isPresenter: false,
					}
				});
			}
		}
	}

	function addAuthor() {
		var isValid = $("#frmAuthor").form("validate");

		if (isValid) {
			var language = "@Model.Language";
			var tmpName = "";
			var strFullName = $("#txtFullName").textbox("getValue");
			var strFamilyName = $("#txtFamilyName").textbox("getValue");
			var strFirstName = $("#txtFirstName").textbox("getValue")

			if (strFullName != null && strFullName != "") {
				tmpName = strFullName;
			} else {
				if (language == "@ConstValues.Language.Cn") {
					tmpName = strFamilyName + strFirstName;
				} else {
					tmpName =  strFirstName + "@ConstValues.chrSpace"+ strFamilyName;
				}
			}

			var tmpAffiliation = "";
			if ($("#txtAffiliation0").textbox("getValue") != "") {
				tmpAffiliation += $("#txtAffiliation0").textbox("getValue");
			}
			if ($("#txtAffiliation1").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation1").textbox("getValue");
			}
			if ($("#txtAffiliation2").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation2").textbox("getValue");
			}
			if ($("#txtAffiliation3").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation3").textbox("getValue");
			}
			if ($("#txtAffiliation4").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation4").textbox("getValue");
			}
			if ($("#txtAffiliation5").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation5").textbox("getValue");
			}
			if ($("#txtAffiliation6").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation6").textbox("getValue");
			}
			if ($("#txtAffiliation7").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation7").textbox("getValue");
			}
			if ($("#txtAffiliation8").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation8").textbox("getValue");
			}
			if ($("#txtAffiliation9").textbox("getValue") != "") {
				tmpAffiliation += "@ConstValues.strSemicolon" + $("#txtAffiliation9").textbox("getValue");
			}

			var tmpCountry = "";
			if ($("#ddlCountry0").combobox("getValue") != "") {
				tmpCountry += $("#ddlCountry0").combobox("getValue");
			}
			if ($("#ddlCountry1").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry1").combobox("getValue");
			}
			if ($("#ddlCountry2").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry2").combobox("getValue");
			}
			if ($("#ddlCountry3").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry3").combobox("getValue");
			}
			if ($("#ddlCountry4").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry4").combobox("getValue");
			}
			if ($("#ddlCountry5").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry5").combobox("getValue");
			}
			if ($("#ddlCountry6").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry6").combobox("getValue");
			}
			if ($("#ddlCountry7").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry7").combobox("getValue");
			}
			if ($("#ddlCountry8").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry8").combobox("getValue");
			}
			if ($("#ddlCountry9").combobox("getValue") != "") {
				tmpCountry += "@ConstValues.strSemicolon" + $("#ddlCountry9").textbox("getValue");
			}

			switch ($("#hdnAuthorWindowType").val())
			{
				case "add":
					var authorList = $("#authorDG").datagrid("getRows");
					for (var index = 0; index < authorList.length; index++) {
						if ($("#txtMail").textbox("getValue") == authorList[index].mail) {
							common.showError("@Resources.MsgTheSameMail");
							return;
						}
					}

					$("#authorDG").datagrid("appendRow", {
						familyName: $("#txtFamilyName").textbox("getValue"),
						firstName: $("#txtFirstName").textbox("getValue"),
						fullName: tmpName,
						affiliation: tmpAffiliation,
						country: tmpCountry,
						address: $("#txtAddress").textbox("getValue"),
						zipCode: $("#txtZipCode").textbox("getValue"),
						mobile: $("#txtMobile").textbox("getValue"),
						mail: $("#txtMail").textbox("getValue"),
						ccMail: $("#txtCcMail").textbox("getValue"),
						selfIntroduction: $("#txtSelfIntroduction").textbox("getValue"),
						status: $("#ddlStatus").combobox("getValue"),
						sort: $("#txtSort").numberbox("getValue"),
						remark: $("#txtRemark").textbox("getValue"),
						isContactAuthor: false,
						isPresenter: false,
						affiliation0: $("#txtAffiliation0").textbox("getValue"),
						affiliation1: $("#txtAffiliation1").textbox("getValue"),
						affiliation2: $("#txtAffiliation2").textbox("getValue"),
						affiliation3: $("#txtAffiliation3").textbox("getValue"),
						affiliation4: $("#txtAffiliation4").textbox("getValue"),
						affiliation5: $("#txtAffiliation5").textbox("getValue"),
						affiliation6: $("#txtAffiliation6").textbox("getValue"),
						affiliation7: $("#txtAffiliation7").textbox("getValue"),
						affiliation8: $("#txtAffiliation8").textbox("getValue"),
						affiliation9: $("#txtAffiliation9").textbox("getValue"),

						country0: $("#ddlCountry0").textbox("getValue"),
						country1: $("#ddlCountry1").textbox("getValue"),
						country2: $("#ddlCountry2").textbox("getValue"),
						country3: $("#ddlCountry3").textbox("getValue"),
						country4: $("#ddlCountry4").textbox("getValue"),
						country5: $("#ddlCountry5").textbox("getValue"),
						country6: $("#ddlCountry6").textbox("getValue"),
						country7: $("#ddlCountry7").textbox("getValue"),
						country8: $("#ddlCountry8").textbox("getValue"),
						country9: $("#ddlCountry9").textbox("getValue"),
					});
					break;
				case "edit":
					var tempId = $("#hdnAuthorGridIndex").val();
					var authorList = $("#authorDG").datagrid("getRows");
					for (var index = 0; index < authorList.length; index++) {
						if ($("#txtMail").textbox("getValue") == authorList[index].mail && index != $("#hdnAuthorGridIndex").val()) {
							common.showError("@Resources.MsgTheSameMail");
							return;
						}
					}

					$("#authorDG").datagrid("updateRow", {
						index: $("#hdnAuthorGridIndex").val(),
						row: {
							familyName: $("#txtFamilyName").textbox("getValue"),
							firstName: $("#txtFirstName").textbox("getValue"),
							fullName: tmpName,
							affiliation: tmpAffiliation,
							country: tmpCountry,
							address: $("#txtAddress").textbox("getValue"),
							zipCode: $("#txtZipCode").textbox("getValue"),
							mobile: $("#txtMobile").textbox("getValue"),
							mail: $("#txtMail").textbox("getValue"),
							ccMail: $("#txtCcMail").textbox("getValue"),
							selfIntroduction: $("#txtSelfIntroduction").textbox("getValue"),
							status: $("#ddlStatus").combobox("getValue"),
							sort: $("#txtSort").numberbox("getValue"),
							remark: $("#txtRemark").textbox("getValue"),
							affiliation0: $("#txtAffiliation0").textbox("getValue"),
							affiliation1: $("#txtAffiliation1").textbox("getValue"),
							affiliation2: $("#txtAffiliation2").textbox("getValue"),
							affiliation3: $("#txtAffiliation3").textbox("getValue"),
							affiliation4: $("#txtAffiliation4").textbox("getValue"),
							affiliation5: $("#txtAffiliation5").textbox("getValue"),
							affiliation6: $("#txtAffiliation6").textbox("getValue"),
							affiliation7: $("#txtAffiliation7").textbox("getValue"),
							affiliation8: $("#txtAffiliation8").textbox("getValue"),
							affiliation9: $("#txtAffiliation9").textbox("getValue"),

							country0: $("#ddlCountry0").textbox("getValue"),
							country1: $("#ddlCountry1").textbox("getValue"),
							country2: $("#ddlCountry2").textbox("getValue"),
							country3: $("#ddlCountry3").textbox("getValue"),
							country4: $("#ddlCountry4").textbox("getValue"),
							country5: $("#ddlCountry5").textbox("getValue"),
							country6: $("#ddlCountry6").textbox("getValue"),
							country7: $("#ddlCountry7").textbox("getValue"),
							country8: $("#ddlCountry8").textbox("getValue"),
							country9: $("#ddlCountry9").textbox("getValue"),
						}
					});
					break;
			}

			$("#authorWindow").window("close");
		}
	}

	function editAuthor(index, tmp) {
		var row = $("#authorDG").datagrid("getData").rows[index];

		$("#txtFamilyName").textbox("setValue", row.familyName);
		$("#txtFirstName").textbox("setValue", row.firstName);
		$("#txtFullName").textbox("setValue", row.fullName);
		$("#txtAddress").textbox("setValue", row.address);
		$("#txtZipCode").textbox("setValue", row.zipCode);
		$("#txtMobile").textbox("setValue", row.mobile);
		$("#txtMail").textbox("setValue", row.mail)
		$("#txtCcMail").textbox("setValue", row.ccMail)
		$("#txtSelfIntroduction").textbox("setValue", row.selfIntroduction);
		$("#ddlStatus").combobox("setValue", row.status);
		$("#txtSort").numberbox("setValue", row.sort);
		$("#txtRemark").textbox("setValue", row.remark);

		$("#ddlCountry0").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: true
		});
		$("#ddlCountry1").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry2").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry3").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry4").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry5").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry6").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry7").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry8").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});
		$("#ddlCountry9").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			required: false
		});

		$("#txtAffiliation0").textbox("setValue", row.affiliation0 != "" ? row.affiliation0 : "");
		$("#txtAffiliation1").textbox("setValue", row.affiliation1 != "" ? row.affiliation1 : "");
		$("#txtAffiliation2").textbox("setValue", row.affiliation2 != "" ? row.affiliation2 : "");
		$("#txtAffiliation3").textbox("setValue", row.affiliation3 != "" ? row.affiliation3 : "");
		$("#txtAffiliation4").textbox("setValue", row.affiliation4 != "" ? row.affiliation4 : "");
		$("#txtAffiliation5").textbox("setValue", row.affiliation5 != "" ? row.affiliation5 : "");
		$("#txtAffiliation6").textbox("setValue", row.affiliation6 != "" ? row.affiliation6 : "");
		$("#txtAffiliation7").textbox("setValue", row.affiliation7 != "" ? row.affiliation7 : "");
		$("#txtAffiliation8").textbox("setValue", row.affiliation8 != "" ? row.affiliation8 : "");
		$("#txtAffiliation9").textbox("setValue", row.affiliation9 != "" ? row.affiliation9 : "");

		$("#ddlCountry0").textbox("setValue", row.country0 != "" ? row.country0 : "");
		$("#ddlCountry1").textbox("setValue", row.country1 != "" ? row.country1 : "");
		$("#ddlCountry2").textbox("setValue", row.country2 != "" ? row.country2 : "");
		$("#ddlCountry3").textbox("setValue", row.country3 != "" ? row.country3 : "");
		$("#ddlCountry4").textbox("setValue", row.country4 != "" ? row.country4 : "");
		$("#ddlCountry5").textbox("setValue", row.country5 != "" ? row.country5 : "");
		$("#ddlCountry6").textbox("setValue", row.country6 != "" ? row.country6 : "");
		$("#ddlCountry7").textbox("setValue", row.country7 != "" ? row.country7 : "");
		$("#ddlCountry8").textbox("setValue", row.country8 != "" ? row.country8 : "");
		$("#ddlCountry9").textbox("setValue", row.country9 != "" ? row.country9 : "");

		$("#trAffiliation1").css("display", row.affiliation1 != "" ? "" : "none");
		$("#trAffiliation2").css("display", row.affiliation2 != "" ? "" : "none");
		$("#trAffiliation3").css("display", row.affiliation3 != "" ? "" : "none");
		$("#trAffiliation4").css("display", row.affiliation4 != "" ? "" : "none");
		$("#trAffiliation5").css("display", row.affiliation5 != "" ? "" : "none");
		$("#trAffiliation6").css("display", row.affiliation6 != "" ? "" : "none");
		$("#trAffiliation7").css("display", row.affiliation7 != "" ? "" : "none");
		$("#trAffiliation8").css("display", row.affiliation8 != "" ? "" : "none");
		$("#trAffiliation9").css("display", row.affiliation9 != "" ? "" : "none");

		$("#hdnAuthorWindowType").val("edit");
		$("#hdnAuthorGridIndex").val(index);
		$("#authorWindow").window("open");
	}

	function deleteAuthor(index, fullName) {
		var confirmMessage = "@Resources.CfmDelete";
		confirmMessage = confirmMessage.replace(/\{0\}/g, fullName);
		$.messager.confirm("@Resources.Delete", confirmMessage, function (r) {
			if (r) {
				$("#authorDG").datagrid("deleteRow", parseInt(index));
				var rows = $("#authorDG").datagrid("getRows");
				for(var index = 0; index < rows.length; index++){
					$("#authorDG").datagrid("updateRow", {
						index: index.toString(),
						row: {
							sort: (index +1).toString(),
						}
					});
				}
			}
		});
	}

	function submitData() {
		var rows = $("#authorDG").datagrid("getRows");

		if (rows.length == 0) {
			var authorIsEmptyError = "@Resources.MsgIsEmpty";
			authorIsEmptyError = authorIsEmptyError.replace(/\{0\}/g, "@Resources.Author");
			common.showError(authorIsEmptyError);
			return;
		}

		var hasPresenter = false;
		for (var index = 0; index < rows.length; index++) {
			if (rows[index].isPresenter == true) {
				hasPresenter = true;
			}
		}
		if (!hasPresenter) {
			common.showError("@Resources.SelectSpeaker");
			return;
		}

		$.messager.confirm("@Resources.Submit", "@Resources.CfmSave", function (r) {
			if (r) {
				var loading = layer.load(0,  {
					shade: [0.4,"#fff"]
				});

				var token = $("#frmAuthor").find('input[name="__RequestVerificationToken"]').eq(0).val();
				var model = {};
				model.conferenceId = $("#hidConferenceId").val();
				model.awardsList =  $("#hidAwardsList").val();

				model.authorList = new Array();
				for (var index = 0; index < rows.length; index++)
				{
					model.authorList.push({
						familyName: rows[index].familyName,
						firstName: rows[index].firstName,
						fullName: rows[index].fullName,
						address: rows[index].address,
						zipCode: rows[index].zipCode,
						mobile: rows[index].mobile,
						mail: rows[index].mail,
						ccMail: rows[index].ccMail,
						selfIntroduction: rows[index].selfIntroduction,
						status: rows[index].status,
						sort: rows[index].sort,
						remark: rows[index].remark,
						isContactAuthor: rows[index].isContactAuthor,
						isPresenter: rows[index].isPresenter,
						affiliation0: rows[index].affiliation0,
						affiliation1: rows[index].affiliation1,
						affiliation2: rows[index].affiliation2,
						affiliation3: rows[index].affiliation3,
						affiliation4: rows[index].affiliation4,
						affiliation5: rows[index].affiliation5,
						affiliation6: rows[index].affiliation6,
						affiliation7: rows[index].affiliation7,
						affiliation8: rows[index].affiliation8,
						affiliation9: rows[index].affiliation9,

						country0: rows[index].country0,
						country1: rows[index].country1,
						country2: rows[index].country2,
						country3: rows[index].country3,
						country4: rows[index].country4,
						country5: rows[index].country5,
						country6: rows[index].country6,
						country7: rows[index].country7,
						country8: rows[index].country8,
						country9: rows[index].country9,
					});
				}

				$.post("@Url.Action(nameof(MeetingContributeController.Submit),
						nameof(MeetingContributeController).GetControllerName())",
					{
						"__RequestVerificationToken": token,
						"model": model,
					},
					function(data, textStatus, jqXHR) {
						if (data.result == "@ConstValues.AjaxFailResult") {
							common.showError(data.message);
							layer.close(loading);
						} else {
							common.showSuccess(data.message, true);
							setTimeout(function () {
								window.location = "@Url.Action(nameof(ProfileContributeInfoController.Index),
								nameof(ProfileContributeInfoController).GetControllerName())";
							}, 2000);
						}
					}
				);
			}
		})
	};

	function checkAgree() {
		var btn = document.getElementById("saveBtn");

		if ($("#transferRight").prop("checked")) {
			btn.className = "lbtn";
			btn.disabled = false;
		} else {
			btn.className = "obtn";
			btn.disabled = true;
		}
	}

	function showPrivacy() {
		@if (Request.Cookies["_culture"] == null || Request.Cookies["_culture"].Value.Equals(ConstValues.Language.Cn)) {
			<text>
			var url = "@Url.Action(nameof(MeetingContributeController.ShowPrivacy),
					nameof(MeetingContributeController).GetControllerName())";
			$.get(url, null, function (data, textStatus, jqXHR) {
				$("#dialogMsg").setApDiv({
					width: 1200,
					height: 600,
					html: data,
				});
			});
			</text>
    		} else {
			<text>
			var url = "@Url.Action(nameof(MeetingContributeController.ShowPrivacyEN),
					nameof(MeetingContributeController).GetControllerName())";
			$.get(url, null, function (data, textStatus, jqXHR) {
				$("#dialogMsg").setApDiv({
					width: 1200,
					height: 600,
					html: data,
				});
			});
			</text>
    		}
	}

	function previewData() {
		conferenceId = "@Model.ConferenceId";

		$("#hidIsNormalPreview").val(0);
		var url = "@Url.Action(nameof(UtilityController.GetCurrentPageItemContribute),
				nameof(UtilityController).GetControllerName())?conferenceId=" + conferenceId;

		$.get(url, null, function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxSuccessResult") {
				for (var index=0; index < data.data.length; index++) {
					if (data.data[index].key == "AbstractFile" ) {
						$("#abstractFileTr").css("display","");
					} else if(data.data[index].key == "SupplementaryFile"){
						$("#supplementaryFileTr").css("display","");
					} else if (data.data[index].key == "Topic")
					{
						$("#topicNameTr").css("display","");
					} else if (data.data[index].key == "Essay")
					{
						$("#essayTypeNameTr").css("display","");
					} else if (data.data[index].key == "Report")
					{
						$("#reportTypeTr").css("display","");
					} else if (data.data[index].key == "Ocis")
					{
					} else if (data.data[index].key == "Journal")
					{
						$("#journalTr").css("display","");
					} else if (data.data[index].key == "ProgramAbstract")
					{
						$("#programAbstractTr").css("display","");
					} else if (data.data[index].key == "Abstract")
					{
						$("#abstractTr").css("display","");
					}
				}
				if ($("#previewProgramAbstract").length > 0 || $("#previewAbstract").length > 0) {
					var language = "@((User as ICISPrincipal).Language)";
					if (language == "@ConstValues.Language.Cn") {
						CKEDITOR.config.language = "zh-cn";
					} else {
						CKEDITOR.config.language = "en";
					}
					initSample();

					if ($("#editor").length > 0) {
						CKFinder.setupCKEditor(CKEDITOR,"~/Scripts/ckfinder/")
						CKEDITOR.instances.editor.setData("");
					}
					if ($("#editorSec").length > 0) {
						ckeditor2 = CKEDITOR.replace("editorSec");
						CKFinder.setupCKEditor(ckeditor2,"~/Scripts/ckfinder/")
						CKEDITOR.instances.editorSec.setData("");
					}
				}
				url = "@Url.Action(nameof(MeetingContributeController.GetPageViewValue),
						nameof(MeetingContributeController).GetControllerName())"
						+ "/" + conferenceId
						+ "?random=" + Math.random();
				$.get(url, null, function (data, textStatus, jqXHR) {
					if (data.result == "@ConstValues.AjaxSuccessResult") {
						$("span[id='l-title']").html(data.data.essayTitle);
						$("span[id='l-keyword']").html(data.data.keyword);
						$("span[id='l-abstractFile']").html(data.data.abstractFile);
						$("span[id='l-supplementaryFile']").html(data.data.supplementaryFile);
						$("span[id='l-topicName']").html(data.data.topicId);
						$("span[id='l-essayTypeName']").html(data.data.essayId);
						$("span[id='l-reportType']").html(data.data.reportId);
						$("span[id='l-journal']").html(data.data.journalId);
						$("span[id='l-programAbstract']").html(data.data.programAbstract);
						$("span[id='l-abstract']").html(data.data.abstract);
						$("span[id='l-awards']").html($("#hidAwardsName").val());

						var authorRows = $("#authorDG").datagrid("getRows");

						var allAuthorList = [];
						var allAffiliationList = [];
						if (authorRows.length > 0) {
							for (var i = 0; i < authorRows.length; i++) {
								var nameString = "";
								var affiliationString = "";
								nameString += authorRows[i].fullName;
								if (authorRows[i].affiliation0 != "") {
									if (jQuery.inArray(authorRows[i].affiliation0, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation0);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation0, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation0, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation1 != "") {
									if (jQuery.inArray(authorRows[i].affiliation1, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation1);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation1, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation1, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation2 != "") {
									if (jQuery.inArray(authorRows[i].affiliation2, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation2);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation2, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation2, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation3 != "") {
									if (jQuery.inArray(authorRows[i].affiliation3, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation3);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation3, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation3, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation4 != "") {
									if (jQuery.inArray(authorRows[i].affiliation4, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation4);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation4, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation4, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation5 != "") {
									if (jQuery.inArray(authorRows[i].affiliation5, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation5);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation5, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation5, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation6 != "") {
									if (jQuery.inArray(authorRows[i].affiliation6, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation6);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation6, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation6, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation7 != "") {
									if (jQuery.inArray(authorRows[i].affiliation7, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation7);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation7, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation7, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation8 != "") {
									if (jQuery.inArray(authorRows[i].affiliation8, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation8);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation8, allAffiliationList) +1).toString();
									}else{
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation8, allAffiliationList) +1).toString();
									}
								}

								if (authorRows[i].affiliation9 != "") {
									if (jQuery.inArray(authorRows[i].affiliation9, allAffiliationList) == -1) {
										allAffiliationList.push(authorRows[i].affiliation9);
									}
									if (affiliationString == "") {
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation9, allAffiliationList) +1).toString();
									} else {
										affiliationString +="@ConstValues.strComma"
										affiliationString +=(jQuery.inArray(authorRows[i].affiliation9, allAffiliationList) +1).toString();
									}
								}
								nameString += "<sup>" + affiliationString + "</sup>"
								allAuthorList.push(nameString)
							}
						}
						var authorString = "";
						var affString = "";
						for(var index = 0 ; index < allAuthorList.length; index++) {
							if (authorString =="") {
								authorString += allAuthorList[index];
							} else {
								authorString += "@ConstValues.chrComma@ConstValues.chrSpace"
								authorString += allAuthorList[index];
							}
						}
						for(var index = 0; index < allAffiliationList.length; index++) {
							if (affString =="") {
								affString += (index + 1).toString() + "@ConstValues.strDot@ConstValues.chrSpace" +   allAffiliationList[index];
							} else {
								affString += "@ConstValues.chrSemicolon@ConstValues.chrSpace"
								affString += (index + 1).toString() + "@ConstValues.strDot@ConstValues.chrSpace" +   allAffiliationList[index];
							}
						}

						$("span[id='l-author']").html(authorString);
						$("span[id='l-affiliation']").html(affString);
					}
				});
			}
		});
		$("#previewWindow").window("open");
	}

	function applyOrDecline(id, name) {
		var awardsList = $("#hidAwardsList").val();
		var awardsName = $("#hidAwardsName").val();
		if (awardsList.indexOf(id) > -1) {
			awardsList = awardsList.replace(id + "@ConstValues.chrSemicolon", "");
			awardsName = awardsName.replace(name + "@ConstValues.chrSemicolon", "");
		} else {
			awardsList += id + "@ConstValues.chrSemicolon";
			awardsName += name + "@ConstValues.chrSemicolon";
		}
		$("#hidAwardsList").val(awardsList);
		$("#hidAwardsName").val(awardsName);
	}
</script>
}